package com.cloud.salon.client.menber.service.impl;

import com.cloud.salon.common.base.response.Res;
import com.cloud.salon.common.crud.service.impl.CRUDServiceImpl;
import com.cloud.salon.client.menber.repository.AccountRepository;
import com.cloud.salon.client.menber.service.AccountService;
import com.cloud.salon.common.base.entity.menber.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/*
 * @Description 顾客Service实现类
 * @Author wolf--LZH
 * @CreateDate 2019/4/26 0026 下午 10:00
 */
@Service
public class AccountServiceImpl extends CRUDServiceImpl<Account, AccountRepository> implements AccountService {

	@Autowired
	private AccountRepository repository;

	public Res<Integer> setBalance(Account account) {
		if (account.getId() == null || account.getBalance() == null)
			return new Res(-3, "参数错误");
		Integer success = repository.setBalance(account.getId(), account.getBalance());

		if (success != null)
			return new Res(0, "修改成功", success);
		else
			return new Res(-3, "修改失败");
	}

}
